package com.library_manage_system.view;

import java.util.ArrayList;

import javax.swing.JPanel;

import com.library_manage_system.base.Observer;
import com.library_manage_system.strategy.PanelStrategy;
import com.library_manager_system.Book;

public class ReturnBookPanel implements Observer {
	public static  WindowsMainImpl windowsMainImpl;
	private static ReturnBookPanel uniqueInstance;
	public static ReturnBookPanel getInstance(WindowsMainImpl windowsMainImpl){
		if(uniqueInstance== null){
			uniqueInstance = new  ReturnBookPanel(windowsMainImpl);
		}
		return uniqueInstance;
	}
	public ReturnBookPanel(WindowsMainImpl windowsMainImpl2){
		this.windowsMainImpl = windowsMainImpl2;
		windowsMainImpl2.registerObserver(this);
	}
	
	public  static PanelStrategy strategy;
	public void SetPanelStrategy(PanelStrategy strategy ){
		this.strategy = strategy;
	}
	@Override
	public JPanel update(ArrayList<Book> list, WindowsMainImpl windowsMainImpl) {
		// TODO Auto-generated method stub
		return uniqueInstance.strategy.createPanel(list, windowsMainImpl);
	}

}
